Proper Database Design

KGR's Amazing DB Summary not the real page name Real Page Name 6b 65 65 70 20 6f 7
Some Simple Rules:
First Normal Form - (1NF) A proper database can not have repeating information in a column or the same information in a row.
Second Normal Form - (2NF) The columns should be dependent on the Primary key. If the primary key consists of multiple pieces of details, the attributes (columns) should be dependent on the entire primary key.
Third Normal Form - (3NF) The primary key should be the only factor affecting the other values in the table.
Tables in the database must have a one-to-one or a one-to-many relationship. There cannot be any many-to-many relationships.
Primary keys always has to have a value while non-primary keys do not.

Example of First Normal Form

Document1_-_Microsoft_Word.jpg

Bold = Primary Key
Red Outline = The Problem (The "Type" column has repeating data; thus, in violation of the First Normal form rule)
Document2_-_Microsoft_Word.jpg


Music Collection Example
tables.pptx_-_Microsoft_PowerPoint_4.jpg
Problem: The "Label" column contains similar data in one cell which is in violation of the First Normal Form.


tables.pptx_-_Microsoft_PowerPoint_5.jpg
tables.pptx_-_Microsoft_PowerPoint_3.jpg



Example of Second Normal Form


Document3_-_Microsoft_Word.jpg

Bold = Primary Key
Red Outline = The Problem This time the "Time Zone" attribute is in violation of the Second Normal Form since the it does not depend on the entire primary keys (Longitude/Latitude); it depends on the Longitude.

Document4_-_Microsoft_Word.jpg



Example of Third Normal Form


Game_ID.docx_-_Microsoft_Word.jpg

Bold = Primary Key
Red Outline = The ProblemThe "Location" attribute is not dependent on the Primary key (Game ID), instead it's related to the Company column.
Game_ID1.docx_-_Microsoft_Word.jpg





Entity Relationship Diagrams


erdexample.gif

http://www.smartdraw.com/resources/tutorials/entity-relationship-diagrams/ Entity Relationship Diagrams are usually used to plan out database layouts. Here is a video that talks more about ER diagrams and how to make them. The picture above is an example of the basic layout of an Entity Relationship Diagram. Each entity is like a table and the attributes are the information in the tables. Each entity is linked to another one through similarities between their primary keys.